package com.example.gmr.Adapter;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.gmr.Entity.Beauty;
import com.example.gmr.Helper.DatabaseHelper;
import com.example.gmr.R;

import java.util.LinkedList;

public class BeautyAdapter extends BaseAdapter {

    private LinkedList<Beauty> linkedList;
    private Context context;
    private DatabaseHelper helper;
    private SQLiteDatabase db;

    public BeautyAdapter(LinkedList<Beauty> linkedList,Context context) {
        this.linkedList = linkedList;
        this.context = context;
    }
    public BeautyAdapter(){}

    @Override
    public int getCount() {  //获取装配进来多少个简历
        return linkedList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View view, ViewGroup viewGroup) {
        String touxiang1=linkedList.get(position).getTouxiang();
        view= LayoutInflater.from(context).inflate(R.layout.list_item,viewGroup,false);

        ImageView touxiang=(ImageView)view.findViewById(R.id.touxiang);
        Glide.with(context).load(touxiang1).into(touxiang);

        TextView name=(TextView)view.findViewById(R.id.name);
        name.setText(linkedList.get(position).getName());

        TextView school=(TextView)view.findViewById(R.id.school);
        school.setText(linkedList.get(position).getSchool());

        TextView grade=(TextView)view.findViewById(R.id.grade);
        grade.setText(linkedList.get(position).getGrade());

        return view;
    }
}
